package com.ita.testmain;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;

import com.ita.vo.User;

public class Test {
	public static void main(String[] args) {
		EntityManagerFactory factory = Persistence.createEntityManagerFactory("CRM");
		EntityManager em = factory.createEntityManager();
		System.out.println(em);
		
		EntityTransaction tx=em.getTransaction();
//		User user=new User("heather","heather");
//		tx.begin();
//		em.persist(user);
//		tx.commit();
//		em.close();
//		factory.close();
		
		tx.begin();
		User user=em.find(User.class, "heather");
		System.out.println(user);
		tx.commit();
		em.close();
		factory.close();
	}
}
